/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.pub.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.pub.entity.PubAffect;
import com.thinkgem.jeesite.modules.pub.dao.PubAffectDao;

/**
 * 单表生成Service
 * @author zmy
 * @version 2019-04-18
 */
@Service
@Transactional(readOnly = true)
public class PubAffectService extends CrudService<PubAffectDao, PubAffect> {
	@Autowired
	private PubAffectDao pubAffectDao;

	public PubAffect get(String id) {
		return super.get(id);
	}
	
	public List<PubAffect> findList(PubAffect pubAffect) {
		return super.findList(pubAffect);
	}
	
	public Page<PubAffect> findPage(Page<PubAffect> page, PubAffect pubAffect) {
		return super.findPage(page, pubAffect);
	}
	
	@Transactional(readOnly = false)
	public void save(PubAffect pubAffect) {
		super.save(pubAffect);
	}
	
	@Transactional(readOnly = false)
	public void delete(PubAffect pubAffect) {
		super.delete(pubAffect);
	}

	@Transactional(readOnly = false)
	public int updatelike(String articleid, String type) {
		// TODO Auto-generated method stub
		if("1".equals(type)) {
			return pubAffectDao.updatelike(articleid);
		}else {
			return pubAffectDao.updatecollect(articleid);
		}
		
	}

	@Transactional(readOnly = false)
	public int wxsave(String id, String title, String authorname, String article, String imgurl, String authorid, String publishtime, String videourl) {
		// TODO Auto-generated method stub
		return pubAffectDao.wxsave(id,title,authorname,article,imgurl,authorid,publishtime,videourl);
	}

	public List<Object[]> affectList() {
		// TODO Auto-generated method stub
		return pubAffectDao.affectList();
	}
	
}